package com.gp.test.factory.abst;

import com.gp.test.factory.model.Huawei;
import com.gp.test.factory.model.Iphone;
import com.gp.test.factory.model.Mi;
import com.gp.test.factory.model.Phone;

public abstract class AbstractFactory {

	protected abstract Phone producePhone();

	public Phone producePhone(String type) {
		if("iphone".equalsIgnoreCase(type)) {
			return new Iphone();
		} else if("huawei".equalsIgnoreCase(type)) {
			return new Huawei();
		} else if("mi".equalsIgnoreCase(type)) {
			return new Mi();
		}
		return null;
	}
}
